package com.dingqb.mycs;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;

import com.base.BaseActivity;
import com.dingqb.mycs.R;
import com.dingqb.mycs.ui.activity.MainTestActivity;

public class LoadingActivity extends BaseActivity {
	private View view;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_loading);
		view = findViewById(R.id.root);
		showLoadingAnim();

	}

	/** 渐变展示启动屏 */
	private void showLoadingAnim() {
		AlphaAnimation anim = new AlphaAnimation(0.2f, 1.0f);
		anim.setDuration(3000);
		view.startAnimation(anim);
		anim.setAnimationListener(new AnimationListener() {
			@Override
			public void onAnimationEnd(Animation arg0) {
				Intent intent = new Intent(LoadingActivity.this, MainActivity.class);
				startActivity(intent);
				LoadingActivity.this.finish();
				// closeLoadingDialog();
			}

			@Override
			public void onAnimationRepeat(Animation animation) {
			}

			@Override
			public void onAnimationStart(Animation animation) {
				// showLoadingDialog("数据加载中...");
			}

		});
	}
}
